from django.db import models
from userServer.models import UserInfo

# Create your models here.
#聊天记录存储在这儿
class ChatRecord(models.Model):
    id = models.AutoField(verbose_name='ID', primary_key=True)
    userId = models.ForeignKey(UserInfo, on_delete=models.CASCADE, verbose_name='用户ID')
    # userId = models.ForeignKey(on_delete=models.CASCADE,to="UserInfo",to_field="id")
    chat_content = models.CharField(verbose_name='聊天内容', max_length=32, default='')
    create_time = models.DateTimeField(verbose_name= '创建时间',auto_now_add=True)
    reply_content = models.CharField(verbose_name='回复内容', max_length=32, default='')
    is_delete = models.BooleanField(verbose_name='是否删除', default=False)

#积分消费记录表
class PointsRecord(models.Model):
    id = models.AutoField(verbose_name='ID', primary_key=True)
    userId = models.ForeignKey(UserInfo, on_delete=models.CASCADE, verbose_name='用户ID')
    # userId = models.ForeignKey(on_delete=models.CASCADE,to="UserInfo",to_field="id")

    points_balance = models.IntegerField(verbose_name='积分余额', default=1000)
    points_consume = models.IntegerField(verbose_name='消费积分', default=0)
    points_type = models.CharField(verbose_name='消费类型', max_length=32, default='')

    create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)